﻿using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace Lib.WPF.Core;
/// <summary>
/// 
/// </summary>
public class BoolToVisibilityConverter : IValueConverter {
    /// <summary>
    /// 
    /// </summary>
    public object Convert(object Value, Type TargetType, object Parameter, CultureInfo Culture) {
        if (Value is bool BoolValue) {
            return BoolValue ? Visibility.Visible : Visibility.Collapsed;
        }
        return Visibility.Collapsed;
    }
    /// <summary>
    /// 
    /// </summary>
    public object ConvertBack(object Value, Type TargetType, object Parameter, CultureInfo Culture) {
        if (Value is Visibility visibility) {
            return visibility == Visibility.Visible;
        }
        return false;
    }
}
